<?php
require_once 'common.php';
require_once "MJDMUser.php";
require_once 'dataCenter.php';

log_action("In Page : ".__FILE__);

$user = GetUserBasicInfo();

//taskid
$id = $_GET["id"];

//points
$points =$_GET['points'];

if($user->getCurPoints() + $points < 0)
{
	echo "Can't get rewards, not enough points!";
	throw "Can't get rewards, not enough points!";
}

//update task status
WonReward($id, $points);

echo "You've taken the reward!";


?>